home *** CD-ROM | disk | FTP | other *** search
/ NOVA - For the NeXT Workstation / NOVA - For the NeXT Workstation.iso / SourceCode / AdobeExamples / NX_Patterns / PSWpatterns.psw < prev    next >
Encoding:
Text File  |  1992-12-19  |  17.9 KB  |  630 lines

  1.  
  2. /*
  3.  * (a)  (C) 1990 by Adobe Systems Incorporated. All rights reserved.
  4.  *
  5.  * (b)  If this Sample Code is distributed as part of the Display PostScript
  6.  *    System Software Development Kit from Adobe Systems Incorporated,
  7.  *    then this copy is designated as Development Software and its use is
  8.  *    subject to the terms of the License Agreement attached to such Kit.
  9.  *
  10.  * (c)  If this Sample Code is distributed independently, then the following
  11.  *    terms apply:
  12.  *
  13.  * (d)  This file may be freely copied and redistributed as long as:
  14.  *    1) Parts (a), (d), (e) and (f) continue to be included in the file,
  15.  *    2) If the file has been modified in any way, a notice of such
  16.  *      modification is conspicuously indicated.
  17.  *
  18.  * (e)  PostScript, Display PostScript, and Adobe are registered trademarks of
  19.  *    Adobe Systems Incorporated.
  20.  * 
  21.  * (f) THE INFORMATION BELOW IS FURNISHED AS IS, IS SUBJECT TO
  22.  *    CHANGE WITHOUT NOTICE, AND SHOULD NOT BE CONSTRUED
  23.  *    AS A COMMITMENT BY ADOBE SYSTEMS INCORPORATED.
  24.  *    ADOBE SYSTEMS INCORPORATED ASSUMES NO RESPONSIBILITY
  25.  *    OR LIABILITY FOR ANY ERRORS OR INACCURACIES, MAKES NO
  26.  *    WARRANTY OF ANY KIND (EXPRESS, IMPLIED OR STATUTORY)
  27.  *    WITH RESPECT TO THIS INFORMATION, AND EXPRESSLY
  28.  *    DISCLAIMS ANY AND ALL WARRANTIES OF MERCHANTABILITY, 
  29.  *    FITNESS FOR PARTICULAR PURPOSES AND NONINFRINGEMENT
  30.  *    OF THIRD PARTY RIGHTS.
  31.  */
  32.  
  33. /*
  34.  *    PSWpatterns.psw
  35.  *
  36.  *    Creator: Carl Orthlieb
  37.  *    CreationDate: 90-11-27
  38.  *    Modified for DPS by Ken Fromm
  39.  */
  40.  
  41. defineps PSWPatternDefs ()
  42.  
  43.     %
  44.     %    This dictionary is for using the font method of pattern display.
  45.     %  It should be used especially for printing because it is much
  46.     %  faster than drawing each cell.
  47.     %
  48.     /PatternDict
  49.     35 dict begin
  50.  
  51.     % PATcg - currentgstate equivalent
  52.     /PATcg {
  53.         8 dict dup begin
  54.             /lw currentlinewidth def
  55.             /lc currentlinecap def
  56.             /lj currentlinejoin def
  57.             /ml currentmiterlimit def
  58.             /ds [ currentdash ] def
  59.             /cc [ currentrgbcolor ] def
  60.             /cm matrix currentmatrix def
  61.         end
  62.     } bind def
  63.  
  64.     % PATsg - setgstate equivalent
  65.     /PATsg { % dict
  66.         begin
  67.             lw setlinewidth
  68.             lc setlinecap
  69.             lj setlinejoin
  70.             ml setmiterlimit
  71.             ds aload pop setdash
  72.             cc aload pop setrgbcolor
  73.             cm setmatrix
  74.         end
  75.  
  76.         % Translate to the current halftonephase if defined
  77.         PATthtp
  78.     } bind def
  79.  
  80.     % PATthtp - translate to current halftonephase
  81.     % Conditionally define PATthtp. If that currenthalftonephase
  82.     % operator exists, then define a procedure to handle phase
  83.     % shifts i.e. scrolling events, otherwise define it as a null procedure.
  84.     /currenthalftonephase where
  85.     {
  86.         pop
  87.         /PATthtp { % - 
  88.             currenthalftonephase    % dx dy
  89.             idtransform            % x y
  90.             translate                % -
  91.         } bind def
  92.     } { /PATthtp { } def } ifelse
  93.  
  94.     % PATsc - setcolor equivalent (takes an array as a parameter instead of loose values)
  95.     /PATsc {            % colorarray
  96.         aload length    % c1 ... cn length
  97.         dup 1 eq { pop setgray } { 3 eq { setrgbcolor } { setcmykcolor } ifelse } ifelse
  98.     } bind def
  99.  
  100.     % PATtcalc - creates a matrix appropriate for the different tiling types.
  101.     /PATtcalc {    % modmtx tilingtype PATtcalc tilematrix
  102.     % Note: tiling type 2 is not currently supported, no adjustment is performed.
  103.         gsave
  104.             exch concat                % tilingtype
  105.             matrix currentmatrix exch     % cmtx tilingtype
  106.             2 ne {    % Tiling type 1 and 3, constant spacing
  107.                     % Distort the pattern so that it occupies an integral number of device pixels
  108.                 dup 4 get exch dup 5 get exch   % tx ty cmtx
  109.                 XStep 0 dtransform round exch round exch    % tx ty cmtx dx.x dx.y
  110.                 XStep div exch XStep div exch           % tx ty cmtx a b
  111.                 0 YStep dtransform round exch round exch     % tx ty cmtx a b dy.x dy.y
  112.                 YStep div exch YStep div exch           % tx ty cmtx a b c d
  113.                 7 -3 roll astore        % [ a b c d tx ty ]
  114.             } if
  115.         grestore
  116.     } bind def
  117.  
  118.     % This junk string is used during the pattern fill
  119.     /PATfstr 1 string def
  120.  
  121.     % PATmp - the makepattern equivalent
  122.     /PATmp {     % patdict patmtx PATmp -
  123.         exch dup length 13 add        % We will add 12 new entries plus 1 FID
  124.         dict copy                    % Create a new dictionary
  125.         begin
  126.             dup /PatMatrix exch def
  127.  
  128.             % Matrix to install when painting the pattern
  129.             TilingType PATtcalc
  130.  
  131.             /PatternGState PATcg def
  132.             PatternGState /cm 3 -1 roll put
  133.  
  134.             % Check for multiple pattern sources (Level 1 fast colour patterns)
  135.             currentdict /Multi known not { /Multi false def } if
  136.             /NumSources currentdict /PaintColors known { PaintColors length } { 1 } ifelse def
  137.  
  138.             % Width and height of the pattern
  139.             /PatWidth XStep PATfstr length mul def
  140.             /PatHeight YStep def
  141.  
  142.             % Font dictionary definitions
  143.             /FontType 3 def  
  144.  
  145.             % Create a dummy encoding vector
  146.             /Encoding 256 array def 
  147.             3 string 0 1 255 { Encoding exch dup 3 index cvs cvn put } for pop
  148.             /FontMatrix matrix def
  149.             /FontBBox BBox def
  150.             /BuildChar {
  151.                 mark 3 1 roll    % mark dict char
  152.                 exch begin
  153.                     Multi { PaintData exch get } { pop } ifelse    % mark [paintdata]
  154.                     PaintType 2 eq Multi or
  155.                     { XStep 0 FontBBox aload pop setcachedevice } 
  156.                     { XStep 0 setcharwidth } ifelse
  157.                     currentdict        % mark [paintdata] dict
  158.                     /PaintProc load    % mark [paintdata] dict paintproc
  159.                 end
  160.                 gsave 
  161.                     false PATredef exec true PATredef
  162.                 grestore
  163.                 cleartomark            % -
  164.             } bind def
  165.             currentdict
  166.         end            % newdict
  167.         /foo exch     % /foo newdict
  168.         definefont    % newfont
  169.     } bind def
  170.  
  171.     % PATpcalc - calculates the starting point and width/height of the tile fill for the shape
  172.     /PATpcalc { % - PATpcalc nw nh px py
  173.         PATDict /CurrentPattern get begin
  174.             gsave
  175.                 % Set up the coordinate system to Pattern Space and lock down pattern
  176.                 PatternGState PATsg
  177.                 % Translate to the beginning of the pattern cell
  178.                 BBox aload pop pop pop translate
  179.  
  180.                 % Determine the bounding box of the shape
  181.                 pathbbox        % llx lly urx ury
  182.             grestore
  183.  
  184.             % Adjust for overlapping patterns
  185.             FontBBox aload pop    % llx lly urx ury llx lly urx ury
  186.             3 -1 roll sub exch        % llx lly urx ury llx h urx
  187.             3 -1 roll sub exch        % llx lly urx ury w h
  188.             exch PatWidth div
  189.             ceiling 1 sub PatWidth mul    % llx lly urx ury h w'
  190.             exch PatHeight div
  191.             ceiling 1 sub PatHeight mul    % llx lly urx ury w' h'
  192.             5 -1 roll exch sub        % llx urx ury w' lly
  193.             4 1 roll                 % llx lly urx ury w'
  194.             5 -1 roll exch sub        % lly urx ury llx
  195.             4 1 roll                % llx lly urx ury
  196.  
  197.             % Determine (nw, nh) the number of cells to paint width and height
  198.             PatHeight div ceiling    % llx lly urx qh 
  199.             4 1 roll                % qh llx lly urx
  200.             PatWidth div ceiling    % qh llx lly qw
  201.             4 1 roll                % qw qh llx lly
  202.             PatHeight div floor        % qw qh llx ph
  203.             4 1 roll                % ph qw qh llx
  204.             PatWidth div floor        % ph qw qh pw
  205.             4 1 roll                % pw ph qw qh
  206.             2 index sub cvi abs     % pw ph qw qh-ph
  207.             exch 3 index sub cvi abs exch    % pw ph nw=qw-pw nh=qh-ph 
  208.  
  209.             % Determine the starting point of the pattern fill (px, py)
  210.             4 2 roll                % nw nh pw ph
  211.             PatHeight mul            % nw nh pw py
  212.             exch                % nw nh py pw
  213.             PatWidth mul exch     % nw nh px py
  214.         end
  215.     } bind def
  216.         
  217.     % PATfill - performs the tiling for the shape
  218.     /PATfill { % nw nh px py PATfill -
  219.         save 5 1 roll
  220.         PATDict /CurrentPattern get dup begin
  221.             setfont
  222.  
  223.             % Set up the coordinate system to Pattern Space
  224.             PatternGState PATsg
  225.  
  226.             % Set the color for uncolored patterns
  227.             PaintType 2 eq { PATDict /PColor get PATsc } if
  228.  
  229.             3 index string PatternDict /PATfstr 3 -1 roll put
  230.  
  231.             % Loop for each of the pattern sources
  232.             0 1 NumSources 1 sub {    % nw nh px py source
  233.                 % Move to the starting location
  234.                 2 index 2 index         % nw nh px py source px py
  235.                 moveto                % nw nh px py source
  236.  
  237.                 % For multiple sources, set the appropriate color
  238.                 Multi { dup PaintColors exch get PATsc } if
  239.  
  240.                 % Set the appropriate string for the source 
  241.                 0 1 6 index 1 sub {        % nw nh px py source 0 1 nw-1
  242.                     PATfstr exch 2 index put
  243.                 } for
  244.                 pop                    % nw nh px py
  245.  
  246.                 % Loop over the number of vertical cells
  247.                 2 index                % nw nh px py nh
  248.                 {                    % nw nh px py
  249.                     % Show a row at a time
  250.                     currentpoint        % nw nh px py cx cy
  251.                     PATfstr show
  252.                     YStep add moveto    % nw nh px py cx cy
  253.                 } repeat
  254.             } for
  255.             pop pop pop pop
  256.         end
  257.         restore
  258.     } bind def
  259.  
  260.     % Save the original routines so that we can use them later on
  261.     /oldfill             /fill load def
  262.     /oldeofill            /eofill load def
  263.     /oldstroke         /stroke load def
  264.     /oldshow            /show load def
  265.     /oldashow        /ashow load def
  266.     /oldwidthshow        /widthshow load def
  267.     /oldawidthshow    /awidthshow load def
  268.     /oldkshow        /kshow load def
  269.     /oldrectfill         /rectfill load def
  270.     /oldrectstroke         /rectstroke load def
  271.  
  272.     % These redefinitions are necessary so that subsequent procs don't bind in
  273.     % the originals
  274.     /PATredef {
  275.         userdict begin
  276.             {
  277.                 /fill             { /clip load PATdraw newpath } bind def
  278.                 /eofill        { /eoclip load PATdraw newpath } bind def
  279.                 /stroke        { strokepath /clip load PATdraw newpath } bind def
  280.                 /show        { 0 0 null 0 0 6 -1 roll PATawidthshow } bind def
  281.                 /ashow        { 0 0 null 6 3 roll PATawidthshow } bind def
  282.                 /widthshow    { 0 0 3 -1 roll PATawidthshow } bind def
  283.                 /awidthshow    { PATawidthshow } bind def
  284.                 /kshow        { PATkshow } bind def
  285.                 /rectfill         { PATrectfill newpath } bind def
  286.                 /rectstroke     { PATrectstroke newpath } bind def
  287.             } {
  288.                 /fill             { oldfill } bind def
  289.                 /eofill         { oldeofill } bind def
  290.                 /stroke         { oldstroke } bind def
  291.                 /show         { oldshow } bind def
  292.                 /ashow        { oldashow } bind def
  293.                 /widthshow    { oldwidthshow } bind def
  294.                 /awidthshow    { oldawidthshow } bind def
  295.                 /kshow        { oldkshow } bind def
  296.                 /rectfill         { oldrectfill } bind def
  297.                 /rectstroke     { oldrectstroke } bind def
  298.             } ifelse
  299.         end
  300.     } bind def
  301.     false PATredef
  302.  
  303.     % PATdraw - calculates the boundaries of the object and fills it with the current pattern
  304.     /PATdraw { % proc
  305.         PATpcalc                    % proc nw nh px py
  306.         gsave
  307.             5 -1 roll  exec                % nw nh px py
  308.             newpath
  309.             PATfill                    % -
  310.         grestore
  311.     } bind def
  312.  
  313.     /PATsstr 1 string def                % This junk string is used by the show operators
  314.             
  315.     % PATawidthshow - awidthshow with the current pattern
  316.     /PATawidthshow {                     % cx cy cchar rx ry string
  317.         % Loop over each character in the string
  318.         {                            % cx cy cchar rx ry ch
  319.             % Show the character
  320.             dup                         % cx cy cchar rx ry char char
  321.             PATsstr dup 0 4 -1 roll put    % cx cy cchar rx ry char (char)
  322.             false charpath                % cx cy cchar rx ry char
  323.             /clip load PATdraw
  324.         
  325.             % Move past the character (charpath modified the current point)
  326.             currentpoint                % cx cy cchar rx ry char x y
  327.             newpath
  328.             moveto                    % cx cy cchar rx ry char
  329.  
  330.             % Reposition by cx,cy if the character in the string is cchar
  331.             3 index eq {                 % cx cy cchar rx ry
  332.                 4 index 4 index rmoveto 
  333.             } if
  334.  
  335.             % Reposition all characters by rx ry
  336.             2 copy rmoveto            % cx cy cchar rx ry
  337.         } forall
  338.         pop pop pop pop pop            % -
  339.         newpath
  340.     } bind def
  341.  
  342.     % PATkshow - kshow with the current pattern
  343.     /PATkshow {    % proc string
  344.         exch bind                     % string proc
  345.         1 index 0 get                    % string proc char
  346.         % Loop over all but the last character in the string
  347.         0 1 4 index length 2 sub 
  348.         {                            % string proc char idx
  349.             % Find the  n+1th character in the string
  350.             3 index exch 1 add get        % string proc char char+1 
  351.             exch 2 copy                % string proc char+1 char char+1 char
  352.  
  353.             % Now show the nth character
  354.             PATsstr dup 0 4 -1 roll put    % string proc char+1 char char+1 (char)
  355.             false charpath                % string proc char+1 char char+1
  356.             /clip load PATdraw
  357.         
  358.             % Move past the character (charpath modified the current point)
  359.             currentpoint newpath moveto                    
  360.             % Execute the user proc (should consume char and char+1)
  361.             mark 3 1 roll                % string proc char+1 mark char char+1
  362.             4 index exec                % string proc char+1 mark ...
  363.             cleartomark                % string proc char+1
  364.         } for
  365.     
  366.         % Now display the last character
  367.         PATsstr dup 0 4 -1 roll put        % string proc (char+1)
  368.         false charpath                    % string proc
  369.         /clip load PATdraw
  370.         newpath
  371.         pop pop                        % -
  372.     } bind def
  373.             
  374.     /PATrectdraw {                     % x y w h
  375.         4 2 roll moveto 1 index 0 rlineto
  376.         0 exch rlineto neg 0 rlineto closepath
  377.     } bind def
  378.  
  379.     /PATrectprocess {
  380.         1 index type /arraytype eq {
  381.             exch 0 4 2 index length 1 sub {
  382.                 dup 3 add 1 exch {1 index exch get exch } for
  383.                 5 1 roll 5 index exec
  384.             } for pop pop
  385.         } { exec} ifelse
  386.     } bind def
  387.  
  388.     % PATrectfill - rectfill with the current pattern
  389.     % IMPORTANT: Does not handle number string arrays.
  390.     /PATrectfill {                         % x y w h or [[x y w h] ... [x y w h]]
  391.         newpath { PATrectdraw /clip load PATdraw } PATrectprocess
  392.     } bind def
  393.  
  394.     % PATrectstroke - rectstroke with the current pattern
  395.     % IMPORTANT: Does not handle number string arrays.
  396.     /PATrectstroke {             % x y w h or [[x y w h] ... [x y w h]] or ... matrix
  397.         newpath 
  398.         dup type /arraytype eq {
  399.             dup length 6 eq
  400.         } { false } ifelse
  401.         {{gsave PATrectdraw null concat strokepath /clip load PATdraw grestore}
  402.             dup length array cvx copy dup 2 4 -1 roll put PATrectprocess }
  403.         {{PATrectdraw strokepath /clip load PATdraw} PATrectprocess } ifelse
  404.     } bind def
  405.  
  406.     /PATDict 3 dict def
  407.  
  408.     % PATsp - the setpattern equivalent
  409.     /PATsp {         % pattern PATsp -
  410.         true PATredef
  411.         PATDict begin
  412.             /CurrentPattern exch def
  413.  
  414.             % If it's an uncolored pattern, save the color
  415.             CurrentPattern /PaintType get 2 eq {
  416.                 /PColor [ currentrgbcolor ] def
  417.             } if
  418.             /CColor [ currentrgbcolor ] def
  419.         end
  420.     } bind def
  421.  
  422.     % PATusp - unsetpattern
  423.     /PATusp {
  424.         false PATredef
  425.         PATDict begin
  426.             CColor aload pop setrgbcolor
  427.         end
  428.     } bind def
  429.  
  430.     % Expand the pattern from a 1 by 1 cell to a cell specified by r and c.
  431.     % Expanding the pattern speeds up the dispaly and printing.
  432.     /PATep {     % r c patdict PATmp newpatdict
  433.         dup length dict copy        % Create a new dictionary
  434.         begin
  435.             [
  436.                 0 XStep dup 4 index 1 sub mul
  437.                 [
  438.                     0 YStep dup 9 index 1 sub mul
  439.                     [
  440.                         % save the graphics state and translate to
  441.                         % the new image position
  442.                         1 /index load /exch load /gsave load /translate load
  443.                         % place copies of the data if it exists and the dictionary
  444.                         % on the stack
  445.                         currentdict /Multi known {
  446.                             Multi {
  447.                                  2 /index load 2 /index load
  448.                             } { 1 /index load } ifelse
  449.                          } { 1 /index load } ifelse
  450.                         /PaintProc load /exec load
  451.                         /grestore load
  452.                     ] cvx /for load /pop load
  453.                 ] cvx /for load
  454.                 /pop load                % pop the dict off the stack
  455.                 % pop the data off the stack if it exists
  456.                 currentdict /Multi known { Multi { /pop load } if } if
  457.             ] cvx /PaintProc exch bind def
  458.  
  459.             % Change the BBox
  460.             BBox 4 array copy dup        % r c [...] [...]
  461.             /BBox exch def aload dup    % r c llx lly urx ury [...] [...]
  462.             5 -1 roll dup 5 -1 roll exch sub    % r c llx urx [...] [...] lly h
  463.             7 index 1 sub YStep mul add    add    % r c llx urx [...] [...] ury
  464.             3 exch put                % r c llx urx [...]
  465.             3 -1 roll dup 4 -1 roll exch sub    % r c [...] llx w
  466.             3 index 1 sub XStep mul add    add    % r c [...] urx
  467.             2 exch put                % r c
  468.  
  469.             % Change the XStep and YStep values
  470.             XStep mul /XStep exch def    % r
  471.             YStep mul /YStep exch def    % -
  472.  
  473.             currentdict
  474.         end            % newdict
  475.     } bind def
  476.  
  477.     currentdict
  478.     end
  479.     def
  480.  
  481.     % A dictionary that changes PATsg to use the matrix stored
  482.     % in CurrentMatrix locking the pattern to the view. Should only
  483.     % be used if that behavior is desired. The default is to use just
  484.     % the dictionary above.
  485.     /PatternViewDict
  486.         5 dict begin
  487.  
  488.     % PATcg - currentgstate equivalent
  489.     /PATcg {
  490.         9 dict dup begin
  491.             /lw currentlinewidth def
  492.             /lc currentlinecap def
  493.             /lj currentlinejoin def
  494.             /ml currentmiterlimit def
  495.             /ds [ currentdash ] def
  496.             /cc [ currentrgbcolor ] def
  497.             /dm matrix currentmatrix def
  498.             /cm matrix currentmatrix def
  499.         end
  500.     } bind def
  501.  
  502.     % PATsg - setgstate equivalent
  503.     /PATsg { % dict
  504.         begin
  505.             lw setlinewidth
  506.             lc setlinecap
  507.             lj setlinejoin
  508.             ml setmiterlimit
  509.             ds aload pop setdash
  510.             cc aload pop setrgbcolor
  511.  
  512.             dm setmatrix  
  513.  
  514.             PATViewDict /CurrentMatrix get    % matrix
  515.             0 0 2 index transform                % matrix tx1' ty1'
  516.             2 index 3 get 0 lt { neg} if        % matrix tx1' ty'
  517.             2 index 0 get 0 lt { exch neg exch } if    % matrix tx1' ty'
  518.             translate
  519.             pop                            % -
  520.  
  521.             PatMatrix TilingType PATtcalc setmatrix
  522.         end
  523.     } bind def
  524.  
  525.     /PATViewDict 1 dict def
  526.  
  527.     % PATspw - sets the pattern in the view
  528.     /PATspv {         % PATspw -
  529.         PATViewDict /CurrentMatrix matrix currentmatrix put
  530.     } bind def
  531.  
  532.     currentdict
  533.     end
  534.     def
  535.  
  536.     % A dictionary that changes PATsg to use the matrix stored
  537.     % in CurrentMatrix locking the pattern to the view but allowing
  538.     % it to scale and rotate as the view does. Should only be used
  539.     % if that behavior is desired. The default is to use just the
  540.     % dictionary above.
  541.     /PatternViewScaleDict
  542.         1 dict begin
  543.  
  544.     % PATsg - setgstate equivalent
  545.     /PATsg { % dict
  546.         begin
  547.             lw setlinewidth
  548.             lc setlinecap
  549.             lj setlinejoin
  550.             ml setmiterlimit
  551.             ds aload pop setdash
  552.             cc aload pop setrgbcolor
  553.  
  554.             PATViewDict /CurrentMatrix get setmatrix
  555.             PatMatrix TilingType PATtcalc setmatrix
  556.         end
  557.     } bind def
  558.  
  559.     currentdict
  560.     end
  561.     def
  562.  
  563. endps
  564.  
  565. /*****************************************************
  566. *
  567. *    The wraps called from the pattern object.
  568. *
  569. *****************************************************/
  570. defineps PSWBeginPattern()
  571.     PatternDict begin
  572. endps
  573.  
  574. defineps PSWSetPattern(userobject PatternNum)
  575.     PatternNum  PATsp
  576. endps
  577.  
  578. defineps PSWUnsetPattern()
  579.     PATusp
  580. endps
  581.  
  582. defineps PSWCheckPattern(char  *PatternName | boolean *Available)
  583.     false Available
  584.     /PatternName  where
  585.     {
  586.         begin
  587.             PatternName type /dicttype eq
  588.             { true Available } if
  589.         end
  590.     } { } ifelse
  591. endps
  592.  
  593. defineps PSWMakePattern(char  *PatternName;  float  Matrix[6])
  594.     PatternName  Matrix  PATmp
  595. endps
  596.  
  597. /*
  598. *    Expands the pattern from 1 image per cell to an R by C matrix. 
  599. *    Assumes the PatternDict is already on the dictionary stack.
  600. */
  601. defineps PSWExpandPattern(char  *PatternName; float Matrix[6]; int R, C)
  602.     R C PatternName PATep Matrix PATmp
  603. endps
  604.  
  605.  
  606. /*
  607. *    These wraps set the state to lock the pattern to the window.
  608. *    The first approach locks the location where the pattern tiles
  609. *    as well as the scale. The pattern appears the same size
  610. *    regardless of the scale of the view.
  611. *
  612. *    The second approach just locks the location to the view but
  613. *    allows the scale to vary which means the pattern cells get 
  614. *    larger and smaller with the scale of the view.
  615. */
  616. defineps PSWBeginPatternView()
  617.     PatternViewDict begin
  618. endps
  619.  
  620. defineps PSWBeginPatternViewScale()
  621.     PatternViewScaleDict begin
  622. endps
  623.  
  624. defineps PSWSetPatternView()
  625.     PatternViewDict begin
  626.         PATspv
  627.     end
  628. endps
  629.  
  630.